package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.bo.AuditTaskBO;
import com.mhc.suzuki.dal.mapper.ext.OrderAuditTaskExtMapper;
import com.mhc.suzuki.dal.model.OrderAuditTaskDO;
import com.mhc.suzuki.dal.query.OrderAuditTaskQuery;
import com.mhc.suzuki.manager.OrderAuditTaskManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


/**
 * Manager for OrderAuditTask.
 */

@Component
public class OrderAuditTaskManagerImpl implements OrderAuditTaskManager {


    @Autowired
    protected OrderAuditTaskExtMapper orderAuditTaskExtMapper;

    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(OrderAuditTaskQuery query) {
        return orderAuditTaskExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(OrderAuditTaskQuery query) {
        return orderAuditTaskExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(OrderAuditTaskDO record) {
        return orderAuditTaskExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(OrderAuditTaskDO record) {
        return orderAuditTaskExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<OrderAuditTaskDO> selectByQuery(OrderAuditTaskQuery query) {
        return orderAuditTaskExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
     */
    @Override
    public PageResult<OrderAuditTaskDO> selectByQueryWithPage(OrderAuditTaskQuery query) {
        PageResult<OrderAuditTaskDO> result = new PageResult<OrderAuditTaskDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public OrderAuditTaskDO selectByPrimaryKey(Long id) {
        return orderAuditTaskExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective(OrderAuditTaskDO record, OrderAuditTaskQuery query) {
        return orderAuditTaskExtMapper.updateByQuerySelective(record, query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery(OrderAuditTaskDO record, OrderAuditTaskQuery query) {

        return orderAuditTaskExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(OrderAuditTaskDO record) {
        return orderAuditTaskExtMapper.updateByPrimaryKeySelective(record);
    }

    /**
     *根据登录员工获取审核待办列表
     * @param queryMap
     * @return
     */
    @Override
    public List<AuditTaskBO> getWaitingTaskListByStaffId(Map queryMap) {
        return orderAuditTaskExtMapper.getWaitingTaskListByStaffId(queryMap);
    }

}